<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>小麻雀接口自动化监控</title>
    <script src="https://cdn.bootcss.com/jquery/3.0.0/jquery.min.js"></script>
    <script type="text/javascript" src="https://assets.pyecharts.org/assets/echarts.min.js"></script>
</head>
<body>
    <div style="font-size: 20pt; padding-left: 37%;">
        <span>小麻雀接口自动化执行结果</span>
        <a style="font-size: 10pt; text-decoration:none;" href="/piecharts/">30秒自动加载数据（或点击刷新）</a>
    </div>
    <div id="pie" style="width:100%; height:900px;"></div>
    <script>
        var chart = echarts.init(document.getElementById('pie'), 'white', {renderer: 'canvas'});
        $(
            function () {
                fetchData(chart);
                setInterval(fetchData, 30000);
            }
        );

        function fetchData() {
            $.ajax({
                type: "GET",
                url: "/piecharts_data/",
                dataType: 'json',
                success: function (result) {
                    chart.setOption(result);
                }
            });
        }
    </script>
</body>
</html>